package cn.net.lwj.sjqy.service.Impl;

import cn.net.lwj.sjqy.dao.mysql.EmpMapper;
import cn.net.lwj.sjqy.dao.mysql.TreeDao;
import cn.net.lwj.sjqy.dao.mysql.UserDao;
import cn.net.lwj.sjqy.dao.mysql1.UserDao1;
import cn.net.lwj.sjqy.entity.User;
import cn.net.lwj.sjqy.service.UserService;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Autowired
    private TreeDao treeDao;

    @Autowired
    private EmpMapper empMapper;

    @Autowired
    private UserDao1 userDao1;
    @Override
    public User getUserById(int id) {
        User u3 =userDao1.getUser(1);

        User u1 = userDao.getUser(id);
        List<Map<String, Object>> list = treeDao.getQgfyTree("114");
        empMapper.selectByPrimaryKey(2);
        //经测试,如果要使用通用mapper,须在实体上加@Id注解
        User u2 =userDao.selectByPrimaryKey(2);

        List<User> userList = userDao.getAllUser();
        //System.out.println(list);
        System.out.println(list);
        System.out.println(u2);
        System.out.println(u3);
        System.out.println(userList);

        //测试插入
        userDao1.insert(userList.get(3));
        userDao1.select(u2);
        return u2;
        //return null;
    }
}
